class RegisterFunction:
    """
    注册单独函数，使用add_function
    """
    __func = []

    @classmethod
    def add_function(cls, func):
        cls.__func.append(func)

    @classmethod
    def clear(cls):
        cls.__func.clear()

    @classmethod
    def do_register(cls, server):
        t = getattr(server, 'register_function', None)
        if t is None:
            return False
        else:
            for f in cls.__func:
                t(f)
            return True


class BaseService(object):

    def __init__(self):
        pass

    def get_info(self, tokens):
        return 'info' + tokens
